import qms.Organisation
import qms.Unit
import qms.Project
import qms.Employee

class BootStrap {

	def init = { servletContext ->

		def org = Organisation.read(1)
		if (!org) {
			org = new Organisation(name: "Main", description: "description goes here")
			org.save()
		}
		
		//def unit1 = new Unit(name: "Unit 1", description: "has some projects")
		//org.addToUnits(unit1)
		//org.addToUnits(new Unit(name: "Unit 2", description: "empty"))
		//org.addToUnits(new Unit(name: "Unit 3", description: "empty"))
//
		//def project1 = new Project(name: "Project 1", description: "empty")
		//def project2 = new Project(name: "Project 2", description: "empty")
		//unit1.addToProjects(project1)
		//unit1.addToProjects(project2)
//
		//def empl1 = new Employee(name: "Vasya", surName: "Pupkin", email:"vasya@mail.pu", birthDay: Date.parse("yyyy-MM-dd", "2009-09-15"), dateEmployed: Date.parse("yyyy-MM-dd", "2009-09-15"))
		//def empl2 = new Employee(name: "Lusya", surName: "Pupkina", email:"lusya@mail.pu", birthDay: Date.parse("yyyy-MM-dd", "2009-09-15"), dateEmployed: Date.parse("yyyy-MM-dd", "2009-09-15"))
		//project1.addToEmployees(empl1)
		//project1.addToEmployees(empl2)

	}

	def destroy = {
	}
}
